Fix broken styles and scripts on extensions page#312
Merged
Conversation
Replace non-existent Indieweb::$version static property with INDIEWEB_VERSION constant to prevent PHP fatal error that blocked CSS and JS from loading.
check_file_extension() received null from get_plugin_file() for uninstalled plugins, triggering a PHP 8.1+ deprecation warning.
The autoloader only loaded the class file when Plugin_Installer was first referenced during page render, which was after admin_enqueue_scripts had already fired. Moving initialization into Indieweb::init() ensures the enqueue hooks are registered early enough for the CSS and JS to load.
Use a custom action (cnkt_installer_enqueue_scripts) triggered from init() instead of hooking admin_enqueue_scripts globally. This ensures assets load only on the extensions page and avoids the timing issue with the autoloader. Also removes check_file_extension() in favor of a null check, matching upstream's fix for the strrchr deprecation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plugin_Installer::enqueue_scripts()referencedIndieweb::$version, a static property that doesn't exist on theIndiewebclassinstaller.cssandinstaller.jsfrom loading on the Extensions pageINDIEWEB_VERSIONconstant, consistent with the rest of the pluginTest plan